<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<div>
    <center>
    <h1 align="center">员工列表</h1>
    <div v-if="isV">
        <a href="">注册</a>
        <a href="javascrpt:void(0)" v-on:click="f1()">登录</a>
    </div>

    <div v-else>
        <input value=""  v-model="name" placeholder="姓名">
        <input type="button"  value="提交" v-on:click="add()">
        <a href="javascrpt:void(0)"  v-on:click="f2()">退出登录</a>
    </div>
    <div v-show="!isV">
        <table border="1">
            <caption>员工列表</caption>
            <tr>
                <th>id</th>
                <th>姓名</th>
                <th>操作</th>
            </tr>
            <tr v-for="(name,i) in arr">
                <td>{{i+1}}</td>
                <td>{{name}}</td>
                <td><a href="javascrpt:void(0)" v-on:click="del(i)">删除</a></td>
            </tr>
        </table>
    </div>
    </center>
</div>

<script src=" https://cdn.staticfile.org/vue/2.2.2/vue.min.js"></script>
<script>
    let v = new Vue({
        el: "body>div",
        data: {
            name:"",
            isV:true,
            arr:["zs","李四"]
        },
        methods: {
            f1(){
                v.isV=false;
            },
            f2(){
                v.isV=true;
            },
            add(){
                v.arr.push(v.name)
            },
            del(i) {
              v.arr.splice(i,1)
            }
        }
    })

</script>
</body>
</html>